package sim.states;

import ctf.network.ProtocolError;
import model.GameConstants;
import sim.ISimulator;
import sim.ISimulator.State;
import utils.CTFGrammar;
/**
 * State responsible for the managing of 
 * @author N. Bhatia, A. Butt, N. Evans, C. Levesque, P. OKeefe
 *
 */
public class VersionState extends AbstractState {

	public VersionState(ISimulator simulator) {
		super(simulator);
	}

	@Override
	public void request(int clientId, String request) throws ProtocolError {
		if (request.equals(CTFGrammar.STEAL + GameConstants.STEAL_VERSION)) {
			this.simulator.setState(clientId, State.REQUEST_SIDE);
			this.simulator.respond(clientId, "STEAL "
					+ GameConstants.STEAL_VERSION);
		} else {
			throw new ProtocolError(CTFGrammar.STEAL + GameConstants.STEAL_VERSION,
					request);
		}
	}

}
